<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>小区信息</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="${resRoot}/layui/css/layui.css" media="all" />
  <link rel="stylesheet" href="${resRoot}/layui/admin/admin.css" media="all" />
	<link id="layuicss-layer" rel="stylesheet" href="${resRoot}/layui/css/modules/layer/default/layer.css" media="all">
</head>
<body layadmin-themealias="default" style="height:100%;" >
          <div class="layui-fluid">   
          <div class="layui-card">
          <div class="layui-card-body">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>查看会员信息</legend>
</fieldset>
 
<form class="layui-form" action="#" >
	<input type="hidden" id="id" value="<#if MemberDTO??>${MemberDTO.id}<#else>0</#if>" >
  <div class="layui-form-item">
    <label class="layui-form-label">昵称</label>
    <div class="layui-input-inline">
      <input type="text" name="name" id="name" readonly="true" value="<#if MemberDTO??>${MemberDTO.nickName}</#if>"  autocomplete="off" placeholder="请输入小区名称" class="layui-input">
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">姓名</label>
    <div class="layui-input-inline">
      <input type="text" name="name" id="name" readonly="true" value="<#if MemberDTO??>${MemberDTO.name!}</#if>"  autocomplete="off" placeholder="" class="layui-input">
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">出生日期</label>
    <div class="layui-input-inline">
      <input type="text" name="name" id="name" readonly="true" value="<#if MemberDTO??>${MemberDTO.birthday!}</#if>"  autocomplete="off" placeholder="" class="layui-input">
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">电话</label>
    <div class="layui-input-inline">
      <input type="text" id="address" readonly="true" value="<#if MemberDTO??>${MemberDTO.tel}</#if>" name="lable"  autocomplete="off" class="layui-input">
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">来源</label>
    <div class="layui-input-inline">
      <input type="text" id="address" readonly="true" value="<#if MemberDTO?? && MemberDTO.source??>${dictMap['member_source'][MemberDTO.source]}</#if>" name="lable"  autocomplete="off" class="layui-input">
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">性别</label>
    <div class="layui-input-inline">
      <input type="text" id="address" readonly="true" value="<#if MemberDTO??>${dictMap['member_sex'][MemberDTO.sex]}</#if>" name="lable"  autocomplete="off" class="layui-input">
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">用户状态</label>
    <div class="layui-input-inline">
      <input type="text" id="address" readonly="true" value="<#if MemberDTO??>${dictMap['member_state'][MemberDTO.state]}</#if>" name="lable"  autocomplete="off" class="layui-input">
    </div>
  </div>
  
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">头像</label>
      <div class="layui-input-inline">
      <div class="site-demo-upload">
  <img id="LAY_demo_upload" src="${MemberDTO.headPic!}" style="max-width:200px;max-height:200px;" >
</div> 
      </div>
    </div>
  </div>
  
<@shiro.hasPermission name="member:test">
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">token</label>
      <div class="layui-input-inline">
      <div class="site-demo-upload">
  <input type="text" id="token" readonly="true" value="<#if MemberDTO?? && MemberDTO.token?? >${MemberDTO.token!}</#if>" name="lable"  autocomplete="off" class="layui-input">
</div> 
      </div>
    </div>
  </div>
  </@shiro.hasPermission>
  
  

  <div class="layui-form-item">
    <div class="layui-input-block">
    <#if MemberDTO?? && MemberDTO.state=='0'>
      <button class="layui-btn" id="submitBtnFrozen"  lay-submit=""  type="button">冻结用户</button>
    </#if>
    <#if MemberDTO?? && MemberDTO.state=='1'>
      <button class="layui-btn" id="submitBtnRelieve"  lay-submit=""  type="button">恢复用户</button>
    </#if>
    <button class="layui-btn" id="resetMember"  lay-submit=""  type="button">重置密码</button>
      <button type="button" class="layui-btn layui-btn-primary" onclick="history.go(-1);" >返回</button>
    </div>
  </div>
</form>
 </div>
          </div>
          </div>
<script src="${resRoot}/layui/layui.js" charset="utf-8"></script>
<script src="${resRoot}/js/jquery.min.js?v=2.1.4"></script>
<script type="text/javascript" src="${resRoot}/js/ajaxfileupload.js"></script>
<script>
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
  
  //自定义验证规则
  form.verify({
    title: function(value){
      if(value.length < 5){
        return '用户名必须不小于5';
      }
    }
    ,pass: [/(.+){6,12}$/, '密码必须6到12位']
    ,content: function(value){
      layedit.sync(editIndex);
    }
  });
  
  $("#resetMember").click(function(){
	  var flag = 0;
	  var id = $("#id").val();
		layer.confirm('确定重置密码吗?', function(index){
			$.ajax({
				type : "post",
				url : "${base}/sys/member/resetPassword",
				data : {
					id : id
				},
				dataType : "json",
				async : false,
				success : function(data) {
					flag  = data.message;
					if(flag == 1) {
						layer.msg('重置成功！', {
						  icon: 1,
						  time: 2000 //2秒关闭（如果不配置，默认是3秒）
						}, function(){
							window.location.reload();
						});   
					} else {
						layer.alert("服务器繁忙，请稍候再试！");
					}
				}
			});
		});
  });
  
  $("#submitBtnFrozen").click(function(){
  layer.confirm('确定冻结该用户吗?', function(index){
		var id = $("#id").val();
				
					$.ajax({
						type : "post",
						url : "${base}/sys/member/frozen",
						data : {
							id : id
							},
						dataType : "json",
						async : false,
						success : function(data) {
							if(data.message == 2) {
								layer.alert('请完善数据');   
									// return false;
								} else if(data.message == 1) {
									layer.msg('冻结成功！', {
									  icon: 1,
									  time: 2000 //2秒关闭（如果不配置，默认是3秒）
									}, function(){
										window.location.reload();
									});   
								} else {
									layer.msg('系统繁忙！'); 
								}
						}
					}); 
  });
	});
	
	$("#submitBtnRelieve").click(function(){
				layer.confirm('确定恢复该用户吗?', function(index){
			var id = $("#id").val();
						$.ajax({
							type : "post",
							url : "${base}/sys/member/relieve",
							data : {
								id : id
								},
							dataType : "json",
							async : false,
							success : function(data) {
								if(data.message == 2) {
									layer.alert('请完善数据');   
										// return false;
									} else if(data.message == 1) {
										layer.msg('恢复成功！', {
										  icon: 1,
										  time: 2000 //2秒关闭（如果不配置，默认是3秒）
										}, function(){
											window.location.reload();
										});   
									} else {
										layer.msg('系统繁忙！'); 
									}
							}
						}); 
				});
	});
  
  
	  
 
	});  
</script>
</body>
</html>
